package gobigcache

import (
	"gitee.com/ichub/goconfig/common/base/baseiface"
	"gitee.com/ichub/goconfig/common/base/baseutils/goutils"
	"gitee.com/ichub/goconfig/common/basedi"
	"github.com/sirupsen/logrus"
)

/*
 * ********************************************************
 * godi工具生成代码，不建议直接修改!
 * ********************************************************
 */

/* ********************************************************
	@Title  文件名称: bigcache_config_init.go
	@Desp   描述:    自动注册注入

	@Author 作者: leijmdas@163.com 时间(2024-07-14 21:21:27)
	@Update 作者: leijmdas@163.com 时间(2024-07-14 21:21:27)

* *********************************************************/

const singleNameBigcacheConfig = "gobigcache.BigcacheConfig"

// init register load
func init() {
	registerBeanBigcacheConfig()
}

// register BigcacheConfig
func registerBeanBigcacheConfig() {
	basedi.RegisterLoadBean(singleNameBigcacheConfig, LoadBigcacheConfig)
}

func FindBeanBigcacheConfig() *BigcacheConfig {
	bean, ok := basedi.FindBean(singleNameBigcacheConfig).(*BigcacheConfig)
	if !ok {
		logrus.Errorf("FindBeanBigcacheConfig: failed to cast bean to *BigcacheConfig")
		return nil
	}
	return bean

}

func LoadBigcacheConfig() baseiface.ISingleton {
	var s = NewBigcacheConfig()
	InjectBigcacheConfig(s)
	return s

}

func InjectBigcacheConfig(s *BigcacheConfig) {

	goutils.Debug("inject")
}
